<?php

require_once('includes/init.inc.php');
require_once('classes/TMSFunctions.cls.php');
require_once('classes/User.cls.php');
require_once('classes/Project.cls.php');
require_once('classes/Task.cls.php');
require_once('classes/Page.cls.php');
require_once('classes/Client.cls.php');


if(!(isset($_SESSION['username'])))
{
	header('Location:index.php');
	die();
}

$username=$_SESSION['username'];
$user = new User(TMSFunctions::getIdFromUsername($username));

$page = new Page();

$page->showHeader($user);/// page header comes here
?>
				
			<div id="mainmenu" class="mainmenu"><!--mainmenu-->
				
				<div id="colortab" class="ddcolortabs">
					<ul>
						<li><a href="" title="PROJECTS" rel="dropmenu1_a">
						<span>PROJECTS</span></a></li>
						<li><a class="pointer" onclick="openPopup('profilePopup')" title="PROFILE"><span>PROFILE</span></a></li>	
					</ul>
				</div>
									
									



				<!--1st drop down menu -->                                                   
				<div id="dropmenu1_a" class="dropmenudiv_a">
				
					<?php 
							$projects=$user->getProjects();
							foreach($projects as $projId)
							{ 
								echo "<a class='pointer' name='$projId' id='$projId' onClick='' >".Project::getProjectNameById($projId).'</a>';

							}
							$pid=$projects[0];
							$pobj= new project($pid);						
							
					?>

					<input type="hidden" id="sort" value="task_name"/>
					<input type="hidden" id="projectid" value="<?php echo $pid;?>"/>
					<input type="hidden" id ="desc" value="false"/>

				</div>



				<script type="text/javascript">
				//SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
				tabdropdown.init("colortab", 3)
				</script>









			</div><!--mainmenu-->
			<div class="clear"></div>
				<div class="submenu" id="submenu">
					<div id="tasks">Projects 
					</div>
					<div id="task_buttons">
						<button onclick="showAddTask()">ADD TASK</button>
						<button id="completed">ADD MEMBER</button>
						<button onclick="showReqExn()">EDIT PROJECT</button>
						<button id="updateProgress">ADD MODULE</button>
					</div>
				</div>


				<div id="dynamic">
					<div id="filter">
						
							<span>
								Search :
						
								<input type="text" maxlength="100" size="25" name="search" id="searchString" />
								<input type="submit" value="Search" onclick="search()" />
								<input type="reset" value="Reset" id="resetButton" />
				
							</span>
						
						<span style="margin-top:5px;display:block;">
						
							Filter by : 
											
							<span id='modulesDiv'><select onChange='sorty(this);' name='filters' class='' id='module'>
<option  value='--MODULES--'>--MODULES--</option>
<option  value='7'>module_bulksms_2</option>
<option  value='1'>module_bulksms_1</option>
</select></span><select onChange='sorty(this);' name='filters' class='' id='status'>
<option  value='--STATUS--'>--STATUS--</option>
<option  value='CLOSED'>CLOSED</option>
<option  value='OPEN'>OPEN</option>
<option  value='COMPLETED'>COMPLETED</option>
<option  value='DEFERRED'>DEFERRED</option>
<option  value='DROP'>DROP</option>
<option  value='REQUIRE_ASSISTANCE'>REQUIRE_ASSISTANCE</option>
</select><select onChange='sorty(this);' name='filters' class='' id='priority'>
<option  value='--PRIORITY--'>--PRIORITY--</option>
<option  value='HIGH'>HIGH</option>
<option  value='NORMAL'>NORMAL</option>
<option  value='LOW'>LOW</option>
</select>						</form>
					
					</div>

					<div id="msg"  class='no2'>

					</div>

					<div id="task_details"><!--task-details-->	
					
															
						<div id='tablediv' >
								
							<?php
									
									$sort="task_name";
				
									$projects=$user->getProjects();

									if(sizeof($projects)==0)
									echo "<tr><div name='no' class='no'>No Records Found!!!!!</div></tr>";
									else
									{								
									$page->showProjectsTable($projects);	
									}
							?>

						</div>        
							

					</div><!--task-details-->


				</div>
				<div id="footer">
					&copy CMM Technologies Pvt Ltd
				</div>
		</div><!--wrapper-->

			<div id="popupAddTask" class="Closebtn" ><!--add task popup-->

					

		 </div><!--add task popup-->


		 <div id="popup_ex" class="Closebtn" ><!--request extension popup-->

					

		 </div><!--request extension popup-->

		 
		 <div class="popups" id="profilePopup"><!--profile popup-->
				<h2 class="center">PROFILE DETAILS</h2>
			<a class="pointer Closebtn2" onclick="closePopup('profilePopup')">x</a>
			<table border=1 align="center" class="protab" cellspacing="5" cellpadding="5" style="width:75%">
				<tr>
					<td>Username</td><td>sac</td>
				</tr>
				<tr>
					<td>First Name</td><td>sac</td>
				</tr>
				<tr>
					<td>Last Name</td><td>vasudev</td>
				</tr>
					<tr>
					<td>Email</td><td>sac@sac.com</td>
				</tr>
				<tr>
					<td>Designation</td><td>Developer</td>
				</tr>
				<tr>
					<td>UserType</td><td>DEVELOPER</td>
				</tr>
				<tr>
					<td>Last login</td><td>2011-10-11 10:44:10</td>
				</tr>
				<tr>
					<td style="text-align:center" colspan="2">
						<button  onclick="edit()">EDIT</button>&nbsp;
						<button onclick="closePopup('profilePopup')">CANCEL</button>&nbsp;
					</td>
				</tr>
			</table>
					 </div><!--profile popup-->

		
		 <div class="popups" id="editProfilePopup"><!--editProfile popup-->
				<h2 class="center">PROFILE DETAILS</h2>
			<a class="pointer Closebtn2" onclick="closePopup('editProfilePopup')">x</a>
			<table border=1 align="center" class="protab" cellspacing="5" cellpadding="5" style="width:75%">
							
				<tr>
					<td>Username</td><td><input type='text' id='editusername' value="sac"></td>
				</tr>
				
				<tr>
					<td>First Name</td><td><input type='text'  id='editfirstname' value="sac"></td>
				</tr>
				<tr>
					<td>Last Name</td><td><input type='text'  id='editlastname' value="vasudev"></td>
				</tr>
					<tr>
					<td>Email</td><td><input type='text'  id='editemail' value="sac@sac.com"></td>
				</tr>	
				<tr>
					<td style="text-align:center" colspan="2">
						<button onclick='save()'id='save'>SAVE</button>&nbsp;
						<button onclick="closePopup('editProfilePopup')">CANCEL</button>&nbsp;
						<button  onClick="changePassword()">CHANGE PASSWORD</button>&nbsp;
					</td>
				</tr>
			</table>
					 </div><!--editProfile popup-->



		<div class="popups" id="changePasswordPopup"><!--password popup-->
					<h2 class="center">PROFILE DETAILS</h2>
			<a class="pointer Closebtn2" onclick="closePopup('changePasswordPopup')">x</a>
			<table border=1 align="center" class="protab" cellspacing="5" cellpadding="5" style="width:75%">
				<tr>
					<td>Old Password</td>
					<td><input type='password' id='oldpass' value=""></td>
				</tr>
				
				<tr>
					<td>New Password</td>
					<td><input type='password'  id='newpass' value=""></td>
				</tr>
				<tr>
					<td>Confirm New Password</td>
					<td><input type='password'  id='cnewpass' value=""></td>
				</tr>
				<tr>
					<td style="text-align:center" colspan="2">
						<button onclick='change()'id='change'>SAVE</button>&nbsp;
						<button onclick="closePopup('changePasswordPopup')">CANCEL</button>						
					</td>
				</tr>
			</table>
		 </div><!--password popup-->
		
		 <div class="popups" id="updateProgressPopup"><!--updateProgress popup-->
					<h2 class="center">UPDATE PROGRESS</h2>
			<a class="pointer Closebtn2" onclick="closePopup('updateProgressPopup')">x</a>
			<table border=1 align="center" class="protab" cellspacing="5" cellpadding="5" style="width:75%">
				<tr>
					<td>Task Name</td>
					<td><input type='text' readonly=readonly id='taskname'  value=""></td>
						<input type='hidden'  id='taskid'  value="">
				</tr>
				
				<tr>
					<td>Percentage</td>
					<td><input type='text' id='percentage' maxlength='3' value="">%</td>
				</tr>
				<tr>
					<td style="text-align:center" colspan="2">
						<button onclick='progress()'id='change'>SAVE</button>&nbsp;
						<button onclick="closePopup('updateProgressPopup')">CANCEL</button>						
					</td>
				</tr>
				
			</table>
		 </div><!--updateProgress popup-->





		 <div id="background"></div>
	</body>
</html>
